package com.sikao.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.sikao.app.R;
import com.sikao.app.bean.SellerOrderDetailBean;

import java.util.List;

/**
 * Created by Administrator on 2016/8/24.
 */
public class SellerOrderExtraInfoAdapter extends BaseAdapter {

	private Context context;
	private List<SellerOrderDetailBean.ResBean.OriginalDataBean.AttrBean> beans;

	public SellerOrderExtraInfoAdapter(Context context, List<SellerOrderDetailBean.ResBean.OriginalDataBean.AttrBean> beans) {
		this.context = context;
		this.beans = beans;
	}

	@Override
	public int getCount() {
		return beans.size();
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view;
		ViewHolder holder;
		if (convertView == null) {
			view = View.inflate(context, R.layout.extra_info_list_item, null);
			holder = new ViewHolder(view);
			view.setTag(holder);
		} else {
			view = convertView;
			holder = (ViewHolder) view.getTag();
		}
		holder.tvtype.setText(beans.get(position).getId() + "：");
		holder.tvvalue.setText(beans.get(position).getValue());
		return view;
	}

	public class ViewHolder {
		public final TextView tvtype;
		public final TextView tvvalue;
		public final View root;

		public ViewHolder(View root) {
			tvtype = (TextView) root.findViewById(R.id.tv_type);
			tvvalue = (TextView) root.findViewById(R.id.tv_value);
			this.root = root;
		}
	}
}
